-
storing a value in html
Hi All,
can i have a javascript value to be stored in html.what exactly i need is suppose
iam declaring like this in JavaScript
var abc = " ";
function sample()
{
// by somehow i am getting this "str" a value i.e.,
str=<pre>sssss</pre>.
// now can i use this string to be passed into div like this
abc = "<html><body><div id=one>"+ str + "</div></body></html>";
alert(abc);
// that means now in alert i should get only "sssss" not "<html><body><div id=one>"+ str + "</div></body></html>". When i am trying like this it is not working for me.
Is there a way?
I dont want this by Document.Write. I want that value to be stored in "abc", not to be printed
}
-
-
You can't alert HTML. Are you trying to just change the html of something in javascript or actually alert HTML? If you're trying to change the html in javascript, take a look at https://developer.mozilla.org/en/DOM/element.innerHTML
or search Javascript innter html
Good luck!
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks