» Home » Javascript » Page 1
how to assign a block of html code to a javascript variable (to invoke a javascript call)
by Icyflash in Javascript

I want to assign a block of html code to a js variable

the html code is


I want to do this

var script = "<script>alert('test');</script>";
document.getElementById('test').innerHTML = script;

but it does not work

if I substitute the tag (o

javascript error “invalid XML attribute value <script language=JavaScript> ”
by mrmt in Web Design

i have some javascript files included in my html file for months. It used to work just fine until couple of days ago, now my scripts don't run anymore and i get javascript error "invalid XML attribute value <script language=JavaScript>
with firebug.

Does anyone know what this error means and how to get rid of it? i guess is something about that

(Ruby,Rails,Javascript) Redirecting/Rendering a different page when Javascript is disabled…?
by Zivic in Javascript

I'm having severe issues with Rails, Javascript, and redirects. Basically I have the "simple" issue of redirecting to a different page if JS is disabled. If JS is enabled, then I add a new item inline immediately -- this works like a charm. However, if JS is disabled I want to redirect to the NEW page of a different controller. Basically the model setup is as such:

Site ->

JSP/Javascript/JQuery: store html/javascript content in a variable + write it to textarea
by Silverforce11 in Web Design

I'm using a json object to store different bits of content, one of which can contain javascript & html relevant content (like quotes, semicolons, tags etc) which without encoding can break the page. To work around this I'm using:


(I'm using JSP as server-side technology and

looking for any codes(javascript/jquery/ajax) like able to pause the javascript and only activate it when onclick else dont do anything
by droom in Javascript

hi i am new here and i need help!
i am looking for simple javascript for okay/cancel function. just like hotmail when want to delete email, it will prompt you whether you wan to proceed or cancel.
my current code will just auto runs two javascript.
so now i am looking for codes like able to pause the javascript and only activate it when onclick else dont do anything.

GWTTestcase accessing javascript object defined in an external javascript file fails
by Alexander Schuc in Javascript

I have defined a GWT module that includes an external javascript file using tag. I have written a GWTTestCase that returns the above described module's name. When my testcase accesses a javascript object I see the following exception

Caused by: com.google.gwt.core.client.JavaScriptException: (null): null

Any idea on how to fix this?

Am I right in assuming

Javascript to set hidden form value on drop down change - options not populating from Javascript array
by Venezuela in Javascript

I have some Javascript code that creates 2 arrays: One for Product Category and one for Product.

But before the user can choose the Product Category or Product, they have to choose the type of Campaign they wish to use. Thus, the selection (event) of the 'Campaign', triggers the hidden drop-down menu from which to choose the Product Category. Once the Product Category is chosen

If I hide a text input element with javascript can other javascript functions still access a value entered into it?
by Javier Pitalua in Javascript

I am trying to use this function:

function storagecalc(){
var thediv=document.forms["boxes"];
var boxno=thediv.elements["numbofboxes"];
var howmany =0; //If the textbox is not blank */
return howmany;
document.getElementById('numberprice').innerHTML = "£"+

Is it necessary to write tests for both Javascript and non-Javascript for apps that “degrade gracefully”?
by Barfo in Javascript

In writing the tests for my Rails 3.2.3 application, I am writing the tests to handle the basic clicking and stuff minus the Javascript. However, I'm leaning heavily on jQuery in the application and I am wondering if I should:

A) Write the tests for JS instead


B) Write the tests for both

I have learned basically everything I know from RailsCast

buttons generated in php and javascript calling a javascript function with an argument just refresh the page
by TheMoo in Javascript

I am trying to generate some buttons to hide a text field on a form with php and javascript, but every time i press the button it just refreshes the page. I cant tell if its the buttons or the function that is having troubles but i am assuming the program is refreshing because it is erroring out.

php generated button

echo("<button id="button".$count."" onclick=dele

Privacy Policy - Copyrights Notice - Feedback - Report Violation - RSS 2017 © bighow.org All Rights Reserved .