|
I get the feeling that you have taken someone else's code and are working through it step by step trying to figure out what is happening. I would suggest you get a good Javscript book or online tutorial, and get comfortable with the language before addressing some more complex issues.
I must get a clever new signature for 2011.
|
|
|
|
|
Richard MacCutchan wrote: I get the feeling that you have taken someone else's code
Sir, I believe that every student do the same thing, because they think they are making a better time. but the truth is that they are wasting their time and also other's.
Help people,so poeple can help you.
|
|
|
|
|
Ali Al Omairi(Abu AlHassan) wrote: they are wasting their time and also other's.
I think that may or may not be the case; I have learned lots of useful things by taking someone else's code and working through it. However, I usually start by studying the basics of the language in question.
I must get a clever new signature for 2011.
|
|
|
|
|
hi,
I have a problem with this code. if you understand this please send me the explantion.
I dont understand the variable intialization. could u please tell me what it means.
var openImage = ""
function getPath(url)
{
lastSlash = url.lastIndexOf("/")
return url.substring(0, lastSlash + 1)
}
regards
manikanta
|
|
|
|
|
Assuming url contains something like "dir/subdir/filename" then you will get the following:
openImage = <IMG SRC="filenamedg
closeImage = .gif" HEIGHT=21 WIDTH=16>
<IMG SRC="filenamedg.gif" HEIGHT=21 WIDTH=16>
I must get a clever new signature for 2011.
|
|
|
|
|
var openImage = "<IMG SRC=\"" + getPath(location.href) + "dg"
var closeImage = ".gif\" HEIGHT=21 WIDTH=16>"
function getPath(url)
{
lastSlash = url.lastIndexOf("/")
return url.substring(0, lastSlash + 1)
}
The code uses location.href, so I think it's looking for a file name dg.gif in the same folder as the web-page being referenced.
Richard MacCutchan wrote:
I think (assuming my page is 'http://mywebdomain/myfolder/mypage.html') this would be:
<IMG SRC="http://mywebdomain/myfolder/dg.gif" HEIGHT=21 WIDTH=16>
"It was when I found out I could make mistakes that I knew I was on to something."
-Ornette Coleman
"Philosophy is a study that lets us be unhappy more intelligently."
-Anon.
|
|
|
|
|
You are right of course, I misread the getPath() function.
I must get a clever new signature for 2011.
|
|
|
|
|
Hi
Thank you for your answer that i last time i asked. Now i want the phone number validation in javascript. How can we validate a phone number. if i give a invalid phone number it gives an error mesage. eg: 000000000
|
|
|
|
|
manikumar_gutti wrote: Thank you for your answer that i last time i asked
In fact you were shown some Google links; perhaps you could learn to do the same for yourself now you know how simple it is.
I must get a clever new signature for 2011.
|
|
|
|
|
Sir, be easy with him.
Sometimes thirsty people need some one to tell them to drink.
100
Help people,so poeple can help you.
|
|
|
|
|
Thirsty people standing in a stream shouldn't need to be told to drink. Even if they stumble they will drink.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
well ..;
as you might know, this can not be applied to all people.
100
Help people,so poeple can help you.
|
|
|
|
|
Or as we say "You can lead a horse to water but you cannot make it drink". However, one of the main qualities necessary to be a programmer (or anything else) is the ability to do one's own research. The sooner some of the questioners here learn that (hard) lesson, the better they will become. Merely posting questions asking others to do the work for them means they will not learn anything of much use, and will certainly not go very far in life.
I must get a clever new signature for 2011.
|
|
|
|
|
|
|
Hello
This is manikumar. I am new to the web developement.
How can we validate a date in javascript
|
|
|
|
|
|
|
Sir, this is what I have for now. But I am thinking about some thing magical (you know what i mean)
do you have any idea.
Help people,so poeple can help you.
|
|
|
|
|
Magical? No I don't think I know what you're talking about.
Please explain!
|
|
|
|
|
i mean OO (Object Oriented). but forget it for now.
|
|
|
|
|
|
|
have a jquery on my aspx page which loads a seperate aspx page through iframe inside a jquery modal. I am passing the the value of a textbox to the jquery-modal. Now I have a gridview in modal popup and evrytime i select a row I want to return those values back to base(parent page and populate some textboxes with gridview row in modal.
I am unable pass values back to base page.
my jquery is as below:-
$(function() {
$("#addForm").dialog({
autoOpen: false,
modal: true,
width: 500,
scroll: true,
overlay: {
"background-color": "#000",
"opacity": "0.5",
"-moz-opacity": "0.5"
}
});
$("#btnAddSession").click(function(event) {
var url = "Result.aspx?key=" + encodeURIComponent($("#<%= txtSearch.ClientID %>").val());
alert(url);
$("#popup").attr("src", url);
$("#addForm").dialog("open");
return false;
});
});
my div is as below:-
<div id="addForm" title="Dialog Title" >
<iframe id="popup" width="480"></iframe>
</div>
This opens the new aspx in the jquery modal and passes the value of textbox which i access serverside to perform my search and bing to gridview. But unable to pass values back to base page.
|
|
|
|
|
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>
|
|
|
|