|
It is category_parent.xml
<?xml version="1.0" ?>
<list>
<item code="77"><![CDATA[A]]></item>
<item code="10"><![CDATA[B]]></item>
<item code="28"><![CDATA[C]]></item>
<item code="7"><![CDATA[D]]></item>
<item code="1"><![CDATA[E]]></item>
<item code="66"><![CDATA[F]]></item>
<item code="11"><![CDATA[G]]></item>
<item code="29"><![CDATA[H]]></item>
<item code="70"><![CDATA[I]]></item>
<item code="9"><![CDATA[J]]></item>
<item code="63"><![CDATA[K]]></item>
<item code="55"><![CDATA[L]]></item>
<item code="6"><![CDATA[M]]></item>
<item code="8"><![CDATA[N]]></item>
</list>
----------------------------------------------------------
It is category_child.xml
<?xml version="1.0" ?>
<list>
<item parent="1" code="3"><![CDATA[E-1]]></item>
<item parent="1" code="2"><![CDATA[E-2]]></item>
<item parent="6" code="32"><![CDATA[M-1]]></item>
<item parent="6" code="33"><![CDATA[M-2]]></item>
<item parent="6" code="30"><![CDATA[M-3]]></item>
<item parent="7" code="37"><![CDATA[D-1]]></item>
<item parent="7" code="35"><![CDATA[D-2]]></item>
<item parent="8" code="41"><![CDATA[N-1]]></item>
<item parent="8" code="39"><![CDATA[N-2]]></item>
<item parent="9" code="54"><![CDATA[J-1]]></item>
<item parent="9" code="44"><![CDATA[J-2]]></item>
<item parent="10" code="47"><![CDATA[B-1]]></item>
<item parent="10" code="48"><![CDATA[B-2]]></item>
<item parent="11" code="52"><![CDATA[G-1]]></item>
<item parent="11" code="50"><![CDATA[G-2]]></item>
<item parent="29" code="62"><![CDATA[H-1]]></item>
<item parent="29" code="85"><![CDATA[H-2]]></item>
<item parent="55" code="60"><![CDATA[L-1]]></item>
<item parent="63" code="68"><![CDATA[K-1]]></item>
<item parent="63" code="75"><![CDATA[K-2]]></item>
<item parent="66" code="69"><![CDATA[F-1]]></item>
<item parent="66" code="67"><![CDATA[F-2]]></item>
<item parent="70" code="71"><![CDATA[I-1]]></item>
<item parent="77" code="82"><![CDATA[A-1]]></item>
<item parent="77" code="79"><![CDATA[A-2]]></item>
</list>
--------------------------------------------------------
List.html
<table cellpadding="0" cellspacing="0" width="176">
<tr>
<td height="24" align="left">
<select id="l_cat_parent" class="txt1" onChange="setCategory(this.value)" style="width:176px;margin-top:2px">
<option>category_parent</option>
</select>
</td>
</tr>
<tr>
<td height="24" align="left">
<select class="txt1" id="l_cat_child" style="width:176px;margin:4px 0 5px 0">
<option>category_child</option>
</select>
</td>
</tr>
</table>
<script type="text/javascript">
function setCategory(parent){
if(parent=='') parent = null;
if(parent==null){
var select_box = "l_cat_parent";
var select_name = "Product Parent";
var xml_url = "/_data/category_parent.xml"
}else{
var select_box = "l_cat_child";
var select_name = "Product child";
var xml_url = "/_data/category_child.xml"
}
DelOption(select_box);
AddOption(select_box,"","Loading...");
var xmlHttpObj = createHttpRequest();
if(!xmlHttpObj) return "Your browser is not supported";
xmlHttpObj.onreadystatechange = function(){
if(xmlHttpObj.readyState == 4) {
if(xmlHttpObj.status == 200) {
var xmlDom = getXMLDOM(xmlHttpObj);
DelOption(select_box);
AddOption(select_box,"",select_name);
var listings = xmlDom.getElementsByTagName("item");
for (var i = 0; i < listings.length; i++) {
var strCode = listings[i].getAttribute("code");
var strParent = listings[i].getAttribute("parent");
var strName = listings[i].firstChild.nodeValue;
if(strParent==parent)
AddOption(select_box,strCode,strName);
}
if($(select_box).getAttribute('selection')!=''){
SetSelectOption(select_box, $(select_box).getAttribute('selection'));
if($(select_box).onchange) $(select_box).onchange();
}else{
SetSelectOption(select_box, '');
}
}
}
}
xmlHttpObj.open("GET", xml_url); // 비동기모드
xmlHttpObj.send(null);
}
var pcategory = getCookieA("cache","pcategory"); // 기존 선택값
var ccategory = getCookieA("cache","ccategory");
$("l_cat_parent").setAttribute("selection",pcategory);
$("l_cat_child").setAttribute("selection",ccategory);
setCategory('');
var cal = new Calendar('leftCalendar');
cal.className = 'cal';
cal.onCalendarClick = function(clickdate){
var cookieDate = new Date();
cookieDate.setTime(cookieDate.getTime() + (1000 * 60 * 60 * 24 * 365 * 10)); // 10년
if($("l_cat_child").value!=''){
cat_no=$("l_cat_child").value;
setCookieA("cache","pcategory",$("l_cat_parent").value,cookieDate);
setCookieA("cache","ccategory",$("l_cat_child").value,cookieDate);
}else{
cat_no=$("l_cat_parent").value;
setCookieA("cache","pcategory",$("l_cat_parent").value,cookieDate);
setCookieA("cache","ccategory","",cookieDate);
}
location = "/product/list.asp?date="+ clickdate +"&cat_no="+ cat_no;
}
cal.Load('','');
</script>
|
|
|
|
|
Use the Code block to format your code in your question.
Then always give meaningful title in the question title. Ex. Javascript - XML code not working(be specific about that)
what's the error message? which line? check in firefox console....let us know.
|
|
|
|
|
var pcategory = getCookieA("cache","pcategory"); // 88 line
var ccategory = getCookieA("cache","ccategory"); // 89 line
|
|
|
|
|
but what's the error message?
|
|
|
|
|
Hi All,
We built an AJAX timeout feature into our web application that prompts the user just before the session is about to expire if they wish to extend the session. This code works fine in IE8 running Windows Server 2008. However, when we upload this to a Windows Server 2003 server and try to view it in IE7, the timeout notification never shows up, even when the session has timedout and no error is reported.
Is there something that needs installing on the server, or some browser setting that may need changing?
Thank you,
Mel
|
|
|
|
|
i have a search on my aspx page and after entering serch text and on click of search button, i open a jquery modal window whioch loads a seperate aspx page in iframe.
I have been unable to pass the values to by jquery modal and also which is the best way to get the values back from the modal. I am calling an external service in the popup which returns data.
Thanks,
|
|
|
|
|
Do you have to pass value to the Popup and get back to the Main page?
sunaSaRa Imdadhusen
+91 99095 44184
+91 02767 284464
|
|
|
|
|
|
You can get Value of Parent page from child like
var parentTextValue = window.parent.document.forms[0].txtBox.value;
Now you can send value to the Parent like
window.parent.document.forms[0].txtBox.value = "Set from child"
Thanks,
Imdadhusen
sunaSaRa Imdadhusen
+91 99095 44184
+91 02767 284464
|
|
|
|
|
window.parent gives an error of null object
|
|
|
|
|
Heya,
I'm trying to combine google streetview with input I get from other scripts.
For example, I get a street name from a other script, but want an streetview window to automaticly load that street.
I've been reading through the google documentation, and tried some examples found on the internet, but my decent lack of js skills are lacking me from getting much further.
Google Maps StreetView[^] is an example, but this one works with an dragger, while I try to make it load automaticly on other input.
Any one who can sling me into the right direction?
|
|
|
|
|
These are the jscript functions you need ...
This function takes an address as a string
function showAddress(thisaddress)
{
var geocoder = new GClientGeocoder();
geocoder.setBaseCountryCode("uk");
geocoder.getLatLng(thisaddress, gotPoint);
searchaddress=thisaddress
}
The next function is called by the one above in order to show the address or marker on a map
Note that I've commented out the code that places a marker at the point
function gotPoint(pt)
{
if (!pt)
{alert(searchaddress + " not found");}
else
{
document.formInput.txtPoint.value = pt;
panoClient.getNearestPanoramaLatLng(pt, fnearestpano);
}
}
Finally, the function finds the nearest StreetView image to the address
function fnearestpano(latlng)
{
if (!latlng)
{ alert("nearest view not found"); }
else
{
myPano = new GStreetviewPanorama(document.getElementById("pano"));
myPano.setLocationAndPOV(latlng, myPOV);
}
}
Hope that helps?
Richard
|
|
|
|
|
Hi,
I am using confirm('Do you want to proceed?'). But here am getting Ok/Cancel alert.
But i need Yes/No option.
How to do that?
|
|
|
|
|
|
|
Sir, your solution is just great..!!
100 , man;
Help people,so poeple can help you.
|
|
|
|
|
Sir, this is the first question i asked my tainners when i move to the web, but i found no answer. so i used a <&div> with style="display:none;position:absolute" as a modal dialog witch i can design freelly.
100
Help people,so poeple can help you.
|
|
|
|
|
For true Javascript standard it is not possible. This will only work on 32 bit Windows and only on IE. On Firefox it will not show Yes/No prompt.
<script language="javascript">
function window.confirm(str)
{
execScript('n = msgbox("'+str+'","4132")', "vbscript");
return(n == 6);
}
var r = confirm("Can you do it?");
alert(r);
</script>
|
|
|
|
|
Hello all,
I am using the Chrome browser to run a simple html test page containing jQuery code.
If I load it from the disk path, it works as expected.
If, instead, I use the IIS, then it gives the $ is not defined error. Funny enough, using the incognito mode makes it work
Any idea about what could be wrong here?
Bogdan Rechi.
|
|
|
|
|
A code sample may help.
Chris J
www.redash.org
|
|
|
|
|
Thank you and Shahriar for the answers. There is nothing special with the source code and it is even located in the same directory as the jQuery. I think it is just related to the way Chrome functions, since it works as expected in the incognito mode.
Here it is a fragment (relevant, I hope):
//...
</style>
<script type="text/javascript" src="jquery-1.5.min.js"></script>
<script type="text/javascript">
var x = 10;
$(window).load( // error here, $ unknown
function()
{
console.info("jquery loaded");
testLoad();
});
//...
Bogdan Rechi.
|
|
|
|
|
I ran this code without error in Chrome v9.0.597.98 beta without issue under the normal mode. Under firefox and IE it complained about console not not being defined.
<html>
<head>
<script type="text/javascript" src="jquery-1.5.min.js"></script>
<script type="text/javascript">
var x = 10;
function testLoad()
{
alert("hi");
}
$(window).load(
function()
{
console.info("jquery loaded");
testLoad();
});
</script>
</head>
<body>
<p>Testing jQuery</p>
</body>
</html>
Chris J
www.redash.org
|
|
|
|
|
Hi,
you need to provide your HTML code where you referenced the jQuery in order to investigate the issue. As of now it seems you are missing relative path respect to your application.
|
|
|
|
|
You should provide HTML code and also mention Directory structure where are you store .js file, this may helpful to diagnose the problem.
sunaSaRa Imdadhusen
+91 99095 44184
+91 02767 284464
|
|
|
|
|
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script>
I hope the above information will be helpful. If you have more concerns, please let me know.
|
|
|
|