|
were you saying that comparison to ="" is not valid? its sometimes a reference to null, right?
is there any way you know of that could make visual studio debug this script? if i put breakpoints on the script it says no, not supported.
fiddle is nice to check syntax; three equals's checks types, so its a bit clearer now
|
|
|
|
|
Debug your JavaScript code inside your browser. Browsers also support this feature.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
debug as in single step? is there no add in to visual studio?
|
|
|
|
|
I'm having problems with external js file. When the function is within the html page, it works fine. as soon as I reference it to external source it doesn't.
External file: xml.js
function helloworld1() {
document.write( helloworld world );
return
}
web page:
<title>
function helloworld1() {
document.write("helloworld world");
return
}
</head>
<body>
<script type="text/javascript"> var m = helloworld();
Click me to display Date and Time.
|
|
|
|
|
Probably your reference is wrong...It may be src="xml.js" or some ore complicated path...Use the built in debugger of your browser and check console messages to see if the external file was loaded at all...
Skipper: We'll fix it.
Alex: Fix it? How you gonna fix this?
Skipper: Grit, spit and a whole lotta duct tape.
|
|
|
|
|
but i can put alert messages in there and they get fired off in other parts of the same script section
you get variables from the database there in that edit form sitting in the controls mostly textboxes and then when clicking submit they all get sent into the db to update the db table
so in the html the variable is there, sometimes its visible in the alert("value is: "+ $'(variablename).val'));
but if the variable.val() isnull or == null or == "" then it should set that variable.val() = "No";
sometimes it works, sometimes not this is with a handler that runs after the window.load ? when the DOM is fully ready and all the images are drawn, then it runs code to check for certain null values and if null replace that with string 'no' otherwise dont care.
thanks
|
|
|
|
|
It works the same. Your problem may be timing issue. The provided code doesn't show the usage of the xml functions and I'm assuming you execute some xml function while the xml.js is being loaded. Before you make any call to functions defined in the xml.js file, you have to make sure that the file has been loaded successful.
|
|
|
|
|
Please how can i input jquery slideshows in my web?
|
|
|
|
|
I have a table with 3 columns. Container # , Container Size and Pickup Location.
I am looping through each of the rows and append all the data to a string variable.
However, I also need to store the Pick up location(input by user, and will be same for all containers in a request) to be stored in a variable. How do I go about it?
The alert does show up onchange of text in textbox txtLocRow1. However the value is not showing up in email.
<table id="tblCtnrInfo" border="0">
<tr>
<td>
<input id="txtLocRow1" onkeypress="keyPressTest(event, this);" name="txtLocRow1" onchange="StoreLocation()" />
</td>
</tr>
</table>
function StoreLocation() {
var j;
for (j = 1; j <= 1; j++) {
_pickLoc.Value = document.getElementById('txtLocRow' + j).value;
alert('Hidden:' + _pickLoc.Value);
}
C# code where I intend to use _pickLoc.Value to show location in email subject.
msg.Subject = "ABC Request from " + tCompany.Value + ": " + uName.Value + ": " + _pickLoc.Value ;
modified 25-Jun-15 11:44am.
|
|
|
|
|
It's best to store it in a hidden textbox.
So if your using asp.net, you make the hidden textbox on the webform, so the server know that it exists, and write to it using Javascript or JQuery.
Now you can post that value back to the server for further processing.
|
|
|
|
|
I am using a hidden input field called _pickLoc which stores the value. Even the alert is displayed. Its just that the value doesn't not appear on the email subject line as it is intended to.
Please let me know if I am missing anything here. Thanks in advance.
|
|
|
|
|
alert('Hidden:' + _pickLoc.Value); // This should confirm that the proper value is stored in the textbox
But the fault I see is that your confused about the client side, which is the browser, and the server side, the web server.
There are 2 ways to pass back the value;
One is a web service, using $AJAX in jquery, you take the _pickLoc and send it back to a web service, the web service picks up the value, creates an email message, and transmits it.
Two is posting back to the server. You have to have a submit button to post the page back to the server. The user clicks the button, a postback is generated, and the server side code reads the textbox value. Then you package your email and transmit it.
|
|
|
|
|
How to compare the tow dates from div element using j query,if the div is like
<div class="col-sm-5 text-right date-time" data-from="2015/6/16 9:20:00" data-to="2015/6/16 10:20:00"> the from and to dates are dynamic.After comparing it should display greater date based on time. If anyone can help.I searched but every where dates were first initialized and then compared.
Thanks
|
|
|
|
|
What have you tried can you add your code here?
modified 20-Sep-20 21:01pm.
|
|
|
|
|
Hi,
I want to convert canvas image to webm video in Mozilla Firefox.
In Chrome, it is easy to use RecordRTC.js.
But Mozilla Firefox doesn't support image/webp format.
How can I convert image to video in Mozilla Firefox?
Please, help.
|
|
|
|
|
You really can't depend upon a browser to do your work for you.
You need to get it on the web server, convert it, store it, and point to it using the proper HTML element.
|
|
|
|
|
I am new to javascript and have to maintain an old application. I would like to know if there is a way I can make this scroller display more than one message at a time.
Thanks.
There is an array messages[] that holds all the messages.
var ie=document.all
var dom=document.getElementById
if (messages.length>2)
i=2
else
i=0
function move1(whichlayer){
tlayer=eval(whichlayer)
if (tlayer.top>0&&tlayer.top<=5){
tlayer.top=0
setTimeout("move1(tlayer)",scrollerdelay)
setTimeout("move2(document.main.document.second)",scrollerdelay)
return
}
if (tlayer.top>=tlayer.document.height*-1){
tlayer.top-=5
setTimeout("move1(tlayer)",50)
}
else{
tlayer.top=parseInt(scrollerheight)
tlayer.document.write(messages[i])
tlayer.document.close()
if (i==messages.length-1)
i=0
else
i++
}
}
function move2(whichlayer){
tlayer2=eval(whichlayer)
if (tlayer2.top>0&&tlayer2.top<=5){
tlayer2.top=0
setTimeout("move2(tlayer2)",scrollerdelay)
setTimeout("move1(document.main.document.first)",scrollerdelay)
return
}
if (tlayer2.top>=tlayer2.document.height*-1){
tlayer2.top-=5
setTimeout("move2(tlayer2)",50)
}
else{
tlayer2.top=parseInt(scrollerheight)
tlayer2.document.write(messages[i])
tlayer2.document.close()
if (i==messages.length-1)
i=0
else
i++
}
}
function move3(whichdiv){
tdiv=eval(whichdiv)
if (parseInt(tdiv.style.top)>0&&parseInt(tdiv.style.top)<=5){
tdiv.style.top=0+"px"
setTimeout("move3(tdiv)",scrollerdelay)
setTimeout("move4(second2_obj)",scrollerdelay)
return
}
if (parseInt(tdiv.style.top)>=tdiv.offsetHeight*-1){
tdiv.style.top=parseInt(tdiv.style.top)-5+"px"
setTimeout("move3(tdiv)",50)
}
else{
tdiv.style.top=parseInt(scrollerheight)
tdiv.innerHTML=messages[i]
if (i==messages.length-1)
i=0
else
i++
}
}
function move4(whichdiv){
tdiv2=eval(whichdiv)
if (parseInt(tdiv2.style.top)>0&&parseInt(tdiv2.style.top)<=5){
tdiv2.style.top=0+"px"
setTimeout("move4(tdiv2)",scrollerdelay)
setTimeout("move3(first2_obj)",scrollerdelay)
return
}
if (parseInt(tdiv2.style.top)>=tdiv2.offsetHeight*-1){
tdiv2.style.top=parseInt(tdiv2.style.top)-5+"px"
setTimeout("move4(second2_obj)",50)
}
else{
tdiv2.style.top=parseInt(scrollerheight)
tdiv2.innerHTML=messages[i]
if (i==messages.length-1)
i=0
else
i++
}
}
function startscroll(){
if (ie||dom){
first2_obj=ie? first2 : document.getElementById("first2")
second2_obj=ie? second2 : document.getElementById("second2")
move3(first2_obj)
second2_obj.style.top=scrollerheight
second2_obj.style.visibility='visible'
}
else if (document.layers){
document.main.visibility='show'
move1(document.main.document.first)
document.main.document.second.top=parseInt(scrollerheight)+5
document.main.document.second.visibility='show'
}
}
window.onload=startscroll
</script>
<ilayer id="main" width=&{scrollerwidth}; height=&{scrollerheight}; bgColor=&{scrollerbgcolor}; background={scrollerbackground}; visibility=hide>
<layer id="first" left=0 top=1 width=&{scrollerwidth};>
<script language="JavaScript1.2">
if (document.layers)
document.write(messages[0])
</script>
</layer>
<layer id="second" left=0 top=0 width=&{scrollerwidth}; visibility=hide>
<script language="JavaScript1.2">
if (document.layers)
document.write(messages[dyndetermine=(messages.length==1)? 0 : 1])
</script>
</layer>
</ilayer>
<script language="JavaScript1.2">
if (ie||dom){
document.writeln('<div id="main2" style="position:relative;width:'+scrollerwidth+';height:'+scrollerheight+';overflow:hidden;background-color:'+scrollerbgcolor+' ;background-image:url('+scrollerbackground+')">')
document.writeln('<div style="position:absolute;width:'+scrollerwidth+';height:'+scrollerheight+';clip:rect(0 '+scrollerwidth+' '+scrollerheight+' 0);left:0px;top:0px">')
document.writeln('<div id="first2" style="position:absolute;width:'+scrollerwidth+';left:0px;top:1px;">')
document.write(messages[0])
document.writeln('</div>')
document.writeln('<div id="second2" style="position:absolute;width:'+scrollerwidth+';left:0px;top:0px;visibility:hidden">')
document.write(messages[dyndetermine=(messages.length==1)? 0 : 1])
document.writeln('</div>')
document.writeln('</div>')
document.writeln('</div>')
}
</script>
modified 24-Jun-15 14:21pm.
|
|
|
|
|
Hi,
I'm going to record remote audio in video chating with WebRTC.
But webrtc provide audio in mono mode, and chrome supports recording only stereo mode.
So, I need to convert audio channel from mono to stereo mode.
Is it possible?
If it possible, how can I do it?
Thanks.
modified 19-Jun-15 4:01am.
|
|
|
|
|
In JavaScript
I need the shortest possible code to generate the 99 bottles of beer on the wall song lyrics into a string (using "\n" as the line separator). The problem is making it grammatically correct while still keeping the code compact.
For a refresher:
99 bottles of beer on the wall, 99 bottles of beer.
Take one down and pass it around, 98 bottles of beer on the wall.
98 bottles of beer on the wall, 98 bottles of beer.
Take one down and pass it around, 97 bottles of beer on the wall.
97 bottles of beer on the wall, 97 bottles of beer.
Take one down and pass it around, 96 bottles of beer on the wall.
...
2 bottles of beer on the wall, 2 bottles of beer.
Take one down and pass it around, 1 bottle of beer on the wall.
1 bottle of beer on the wall, 1 bottle of beer.
Take one down and pass it around, no more bottles of beer on the wall.
I'm searching for the cleverest, most compact approach.
Any ideas?
|
|
|
|
|
It's your homework; you do it. Or maybe you could search for a website with that problem already written in many languages...
|
|
|
|
|
Course I can do it, I just want to see some new, clever approaches.
What, does nobody code for fun anymore? Here, i'll post mine.
|
|
|
|
|
Here's the one I made. 194 characters long. This is my first time code golfing, but I think i'm getting the hang of it.
for(var $=b=c=d='',_=99,a=' on the wall.';b=' bottle'+(~(_-2)?'s':d)+' of beer',_>~0;c=_--&&'\n\n') 99-_&&($+='.\nTake one down and pass it around, '+(_||'no more')+b+a),$+=_?c+_+b+a+', '+_+b:d;
console.log($);
modified 16-Jun-15 23:53pm.
|
|
|
|
|
|
|
How to bind image in jquery. am unable to bind image when i wrote the below code plz help me
jQuery(document).ready(function () {
$("#uploadEditorImage").change(function () {
var data = new FormData();
var files = $("#uploadEditorImage").get(0).files;
if (files.length > 0) {
data.append("HelpSectionImages", files[0]);
}
$.ajax({
url: "../Account/UploadFile/",
type: "POST",
processData: false,
contentType: false,
data: data,
success: function (response) {
jQuery("#selimgs_", top.document).attr('src', response);
},
error: function (er) {
}
});
});
});
|
|
|
|