What is the use of SRC in JavaScript syntax?
Answers
Answered by
2
I want to use a javascript variable as a 'src' attribute for another tag on the same jsp.
<script>
var link = mylink // the link is generated based on some code
</script>
I want to create this new element as shown below.
<script src="mylink">
</script>
On searching various forums, I have tried using the following options but they don't seem to work. I want this thing to work on all major browsers.
Put this code in the first element.
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "path/to/somelink";
document.body.appendChild(script);
Use document write method in the first element.
document.write("<script type='text/javascript' src="+ google.com + "><\/script>");
Tried to set a JSTL Variable in the first element and use it.
<script>
var link = mylink // the link is generated based on some code
</script>
I want to create this new element as shown below.
<script src="mylink">
</script>
On searching various forums, I have tried using the following options but they don't seem to work. I want this thing to work on all major browsers.
Put this code in the first element.
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "path/to/somelink";
document.body.appendChild(script);
Use document write method in the first element.
document.write("<script type='text/javascript' src="+ google.com + "><\/script>");
Tried to set a JSTL Variable in the first element and use it.
siddhartharao77:
Next time write the code properly.
Answered by
2
About SRC:
(1) SRC stands for source.
(2) When u want to specify an external file, use SRC attribute.
(1) SRC stands for source.
(2) When u want to specify an external file, use SRC attribute.
Similar questions