|
Hi,
Can someone show me an example of how one could use drap and drop to link 2 items from seperate tables into a third table.
Table1:
ID
Name
Table2:
ID
Name2
Table3:
Table1.ID
Table2.ID
|
|
|
|
|
There are many jQuery plugins to allow you to do drag and drop. I would suggest googling for jquery drag and drop and you should have many samples to choose from.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Hi all, I have an iframe in a web page and let's call this page, PageA. How do I get the id of what ever object I want in the page being displayed inside the IFRAME, by clicking on it? Of course the web page being displayed inside the iframe must be in the same domain as PageA. I have searched online for the answer but all I was able to gather is that one must use jQuery's .contents() method. I have tried the following inside of document.ready based on my finding but it doesn't work.
var myObjId = $("#myiframe").contents().find($(this)).click(function(){$(this).attr("id")});
Please point out why it does not work, thanks in advance.
modified 9-Apr-14 0:58am.
|
|
|
|
|
It may not work because document.ready may be firing before the iframe is even loaded so it won't find it.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
I have the following to play a video dynamically by specify the media name and its path. There are multiple links on the same page. A user can click on each link to play a video.
<p><a onclick="getTitle(1)" href="/sites/Management_Development/Pages/leadership_videos.aspx?MediaFileName=../extraDegree.mp4">video 1</a></p>
I'd also like to add a label somewhere on the screen so the user knows which video he is playing.
I tried the following, by calling getTitle with a number to output the title of the video. The problem is it replace the whole screen instead of placing it somewhere on the screen. So how can I achieve what i need?
Thanks for your help,
function getTitle(tTitle)
{
myTitle = ""
if (tTitle == 1) {
myTitle = "video 1"
} else if (tTitle == 2) {
myTitle = "video 2"
} else if (tTitle == 3) {
myTitle = "Video 3"
} else if (tTitle == 4) {
myTitle = "Video 4"
}
document.write("<br>");
document.write("Now Playing: " + myTitle);
}
|
|
|
|
|
I ran your script through a Javascript Lint validator and adjusted it.
writeIn will add a linefeed to the end.
The value is not an number NAN, and is a string unless your parseInt(tTitle);
But I would of just made a span tag with an ID, and wrote the the span tag for the label, and not document write.
function getTitle(tTitle)
{
myTitle = "";
if (tTitle === '1') {
myTitle = "video 1"
} else if (tTitle === '2') {
myTitle = "video 2"
} else if (tTitle === '3') {
myTitle = "Video 3"
} else if (tTitle === '4') {
myTitle = "Video 4"
}
document.writeIn('');
document.write('Now Playing: ' + myTitle);
|
|
|
|
|
Thanks for the help. I still can't get it to work. Chrome Javascript console says Uncaught TypeError: Object #<HTMLDocument> has no method 'writeIn'
Can you give hint on the approach you prefer? I'm a newbie on Javascript.
Thanks,
|
|
|
|
|
Below is code I have been trying. Everything works except the focus. When the alert box's OK is clicked, focus is not set to the blank text/textarea control that caused the error to happen. According to articles online, this should work but it is not. Any suggestions would be greatly appreciated.
<!DOCTYPE html>
<html lang="en">
<head>
<meta "charset=utf-8" />
<title>Trying It Out</title>
<script type="text/javascript">
function checkForm()
{
var str = '';
var e = document.getElementById('myForm').elements;
for(i=0; i <= e; i++){
if(e[i].value.length <1){
alert("The field " + e.[i].name + " is blank");
var mytext = document.getElementById(e[i].name)
mytext.focus();
return false;
}
}
}
</script>
</head>
<body>
<form id="myForm" name="myForm" action="showIt.htm">
<p>
Your Name: <br /><br />
<input type="text" name="Your_Name" value="enter your name" />
</p>
<p>
Interesting Fact About You: <br /><br />
<textarea name="Interesting_Fact">something about you</textarea>
</p>
<input type="submit" value="Submit Data" onclick="return checkForm(this.form);" />
</form>
<hr />
<div id="showTheValues"></div>
</body>
</html>
|
|
|
|
|
It could be the syntax error, add a semicolon at the end of this line:
var mytext = document.getElementById(e[i].name)
|
|
|
|
|
Please note the changes...
<!DOCTYPE html>
<html lang="en">
<head>
<meta "charset=utf-8" />
<title>Trying It Out</title>
<script type="text/javascript">
function checkForm()
{
var str = '';
var e = document.getElementById("myForm").elements;
for (var i = 0; i < e.length; i++) {
var val = e[i].value;
if (val.length == "" ) {
alert("The Field " + e[i].name + " is blank")
e[i].focus();
return false;
}
}
}
</script>
</head>
<body>
<form id="myForm" name="myForm" action="showIt.htm">
<p>
Your Name:
<input id="Your_Name" type="text" name="Your_Name" value="enter your name" />
</p>
<p>
Interesting Fact About You:
<textarea id="Interesting_Fact" name="Interesting_Fact">something about you</textarea>
</p>
<input type="submit" value="Submit Data" onclick="return checkForm()" />
</form>
<hr />
<div id="showTheValues"></div>
</body>
</html>
modified 19-Apr-14 16:50pm.
|
|
|
|
|
Please use following solution. I have verified and it is working fine for textbox.
function checkForm()
{
var str = '';
var e = document.getElementsByTagName('input');
for(i=0; i <= e.length; i++){
var type = e[i].getAttribute('type');
if(type == "text" || type == "textarea"){
if(e[i].value.length <1){
alert("The field " + e[i].name + " is blank");
e[i].focus();
return false;
}
}
}
}
|
|
|
|
|
|
e.[i].name
what's the f***ing dot between e and [i] for?
|
|
|
|
|
Hi,
I have Two text boxes which are hide when it's in a list. After Clicking Edit, I would like to show the text boxes visible.
From the below code when I say the text box "visible" it displays accordingly. But I need to show the text boxes when it's in a edit mode.
Please help me how to visible/show when i click the button.
- show the text boxes after i click the "Edit" button
- hide the text boxes after I click the "save" button.
Thanks for reading and help would be great.
@model IEnumerable<NameList>
<script src="~/Scripts/jquery-1.10.2.min.js"></script>
<script type="text/javascript">
function ShowEdit(par) {
$("#divBDate-" + par).attr("class", "hide");
$("#txtBDate-" + par).attr("class", "visible");
$("#divEDate-" + par).attr("class", "hide");
$("#txtEDate-" + par).attr("class", "visible");
$("#btnEdit-" + par).attr("class", "hide");
$("#btnSave-" + par).attr("class", "visible");
}
function SaveEdit(par) {
$("#divBDate-" + par).attr("class", "visible");
$("#txtBDate-" + par).attr("class", "hide");
$("#divEDate-" + par).attr("class", "visible");
$("#txtEDate-" + par).attr("class", "hide");
$("#btnEdit-" + par).attr("class", "visible");
$("#btnSave-" + par).attr("class", "hide");
var -bDate = $("#txtBDate-" + par).val();
var -dDate = $("#txtEDate-" + par).val();
var url = '@Url.Action("GetUser", "Cust")';
$.post(url, { RoleId: par, userId: -userId, startDate: -startDate },
function (data) {
$("#divResult").html(data);
});
}
</script>
<div id=divResult">
<table class="table">
<tr>
<th>Name</th>
<th>Area</th>
<th>Beginning Date</th>
<th>End Date</th>
</tr>
@foreach (NamesList n in Model)
{
<tr>
<td> @n.Name </td>
<td>@n.Area </td>
<td>
<div id="divBDate-@n.ID" class="visible">@n.BDate</div>
<input id="txtBDate-@n.ID type=" text" class="hide" value=@n.BDate />
</td>
<td>
<div id="divEndDate-@n.ID" class="visible">@n.EndDate</div>
<input id="txtEndDate-@n.ID type=" text" class="hide" value=@n.EndDate />
</td>
<td>
<button id="btnEdit-@n.ID" class="visible" onclick="ShowEdit(@n.ID); return false;">Edit</button>
<button id="btnSave-@n.ID" class="hide" onclick="SaveEdit(@n.ID); return false;">Save</button>
</td>
</tr>
}
</table>
</div>
|
|
|
|
|
|
I want to call a server side function in javascript function, without AJAX involved. Possible??
Eg:
onblur=<%# checkname() %>
Any idea guys?
|
|
|
|
|
Without AJAX? Why? To call server side you have to go to the server with either a full postback or a partial postback (ajax).
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
no...it's a good idea to use AJAX.
|
|
|
|
|
$.ajax({
type: "GET",
url: url,
contentType: "application/json; charset=utf-8",
crossDomain: true,
dataType: "json",
success: function (msg) {
alert(Response.ErrorMessage )
},
error: function (e, status) {
alert(e + " Fail " + status)
}
});
|
|
|
|
|
Hi
i have created tree for data from table using javascript . But It will not be show correct output in tree structure. Please give me the correct codes for binding data from database into tree using javascript
|
|
|
|
|
There are 1,335,342 different ways to do a tree view. We can help much better if you will post your code and show us where you are stuck.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
have you written code for the same?
|
|
|
|
|
Hi All,
I am trying to load large XML file(222 MB) using javascript for HTML format. It is taking a lot of time.
Can anyone suggest me to make it more efficient?
Any sample is more appreciated.
I am using something like below,
var xmlDoc=null;
if (window.ActiveXObject) //IE 8,9
{
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
}
else if (document.implementation.createDocument)
{
xmlDoc=document.implementation.createDocument ("","",null);
}
else
{
alert('Your browser cannot handle this script');
}
if (xmlDoc!=null)
{
xmlDoc.async=false;
xmlDoc.load('Load.xml'); // Large xml file
}
|
|
|
|
|
http://www.codeproject.com/Questions/749988/hi-how-to-validate-gridview-databound-textbox-valu
hi-how-to-validate-gridview-databound-textbox-value and duplicate record
|
|
|
|
|
Please do not spam the forums like this. Be patient, your question wiull be answered when someone has time and inclination to look at it.
|
|
|
|