Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Question with variables

Status
Not open for further replies.

lyric0n

Technical User
Dec 28, 2005
74
Hello,

What I need to do is called location.host, then based on that, run through a series of If statements and ultimately turn up a variable based on location.host. With that variable, say X, I need that value to be in a string (not sure what it is called exactly), that looks like this:

<script src=X type="text/javascript"></script>

And whenever my application calls this src=, I need it to return the value of X that was determined in my If statements. Is this possible or is there possible another way of doing this?

Thanks,
Chris
 
I have no idea exactly what you are trying to accomplish here.

However, I query location.host and set a variable based on the result returned from the query.

Go to thread216-1305745 and examine the code there and see if it helps you in any way.


mmerlinn

"Political correctness is the BADGE of a COWARD!"

 
Similar to the thread mmerlinn posted, once your code calculates the X (name of the JS source file, you can use:
Code:
document.write('<script src="' + X + '" type="text/javascript"></scr' + 'ipt>');

You should split the closing script tag inside the document.write() method so it isn't interpreted as the closing script tag for the Javascript code that's doing the document.write() statement.

Lee
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top