How do I insert this: <script language="JavaScript" type="text/javascript" src="http://www.ABC.com/members/display.php?token=email"></script>

Into the values of this:
<input id="Email" name="Email" type="text" size="30" /><input name="emailagent" type="HIDDEN" class="textfield" id="emailagent" value='' />

Recommended Answers

All 3 Replies

Do you want to insert the whole string starting from <script... or you want to insert a certain part? If it is the whole string, you could simply put it in the input tag value. I assume that your target input is 'Email'.

document.getElementById("Email").value = "<script language=\"JavaScript\" type=\"text/javascript\" src=\"http://www.ABC.com/members/display.php?token=email\"></script>"

Maybe I did not do it right. Do I put the above code into the values field? If so it did not seem to work. Let me know.

Actually I am not really sure what element you want the output to be inside... Also, I am not really sure how you want the output to look like... Sometimes, you may need to escape '<' with '&lt;' and '>' with '&gt;' as well if you are displaying it (not inside an input or textarea box). Also, you may need to escape double quotes if you are not using them inside a single quote for a whole string. By the way, what I did about for assignment is what you want (assign to 'email' input element)?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.